<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="keywords" content="O3d 03d O3d应用 O3d建模 O3d程序 web3d应用 web3d建模 web3d程序 在线建模 方块模型 "/>
<meta name="description" content="运用O3d的在线建模程序，轻松建造只属于你自己的方块模型，随意成型，随意上色，eizia为您打造有趣的在线建模体验！"/>

<title>在这里自由的创建和编辑您的方块！</title>


<link type="text/css" rel="stylesheet" href="http://www.eizia.com/icss/global.css" />
<script type="text/javascript" src="http://www.eizia.com/webscript/jQuery.js"></script>
<script type="text/javascript" src="http://www.eizia.com/webscript/jQuery-ui.js"></script>
<script type="text/javascript" src="http://www.eizia.com/webscript/ajax.js"></script>
<script type="text/javascript" src="http://www.eizia.com/webscript/md5.js"></script>
<script type="text/javascript" src="http://www.eizia.com/webscript/homeAction.js"></script>
<script type="text/javascript" src="http://www.eizia.com/o3djs/base.js"></script>
<script type="text/javascript" src="http://www.eizia.com/escript/o3dAll.js"></script>
<script type="text/javascript">



function startLoad(){
	//两层的回调函数，第一步先检查登录状态，等待信息返回后调用加载右边栏HTML的函数，等待加载完成后调用tabs初始化函数。
	checkSignState(function(online){
		init();
		loadDocTo('http://www.eizia.com/userTabs.html',document.getElementById('userTabs'),
					function(){	document.getElementById("userNameSpace").innerHTML = userName;//读取名字
								startUserTabs(online);
								});
				});
	}

function getAJAXObject(){
	var xmlHttp=null;
	try{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
		catch(e){
			// Internet Explorer
			try{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e){
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
						}
			}
	return xmlHttp;
	}
	
var AJAX_saveModel;
var AJAX_loadModel;
var capSrc;

function saveToServer(string,name,description){
	
	String.prototype.trim=function() { return this.replace(/(^\s*)|(\s*$)/g,""); }  
	name = name.trim();
	description = description.trim();
	if(description.length == 0){
	alert("名称不能为空！");
		}else if(description.length == 0){
			alert("描述不能为空！");
			}else{
				AJAX_saveModel = getAJAXObject();
				if(AJAX_saveModel==null){
					alert ("Browser does not support HTTP Request");
					return;
					}
					
				capSrc = e1.toDataURL("image/png");
				capSrc = capSrc.slice(22);
				capSrc = capSrc.replace(/\+/g,"%2B");
					
					
				var url="createModelPage.php"
				url = url +"?sid="+Math.random();
				AJAX_saveModel.open("POST",url,true);
				AJAX_saveModel.onreadystatechange = savedTips;	
				AJAX_saveModel.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf8");
				AJAX_saveModel.send("state=saveModel&"+
									"stringData="+string+"&"+
									"captureData="+capSrc+"&"+
									"description="+description+"&"+
									"name="+name
									);
				}
	}
	
function savedTips(){
	if (AJAX_saveModel.readyState==4 || AJAX_saveModel.readyState=="complete")
		{ 
		var xmlDoc = AJAX_saveModel.responseXML;
		var newPage = xmlDoc.getElementsByTagName("newPage");
		var info = newPage[0] ? newPage[0].childNodes[0] : false;
		var signNot = xmlDoc.getElementsByTagName("signNot");
		var signAlert = signNot[0] ? signNot[0].childNodes[0] : false;
		
		if(info){
			window.location.href= info.childNodes[0].nodeValue;
			}
		if(signAlert){
			alert ("请在右上角处登录后重试！");
			}	
		
		} 
	}

function wantSave(){
	document.getElementById("cubeTitleButton").style.display = "none";
	document.getElementById("cubeInformation").style.display = "";
	
	var o3dDiv = document.getElementById("o3d");
	o3dDiv.style.width = "640px";
	o3dDiv.style.height = "340px";
	setTimeout(function(){resizeClient();},50);
	
	mouseMode = false;
	document.getElementById("cubeInformationForm").cubeData.value = 
							e110.e111(e62[e62.length-1]);
	e104.cancel();
//////////////////要加上取消所有场景中的对话框///////////////
	}
	
function cancelSave(){
	document.getElementById("cubeTitleButton").style.display="";
	document.getElementById("cubeInformation").style.display = "none";
	
	var o3dDiv = document.getElementById("o3d");
	o3dDiv.style.width = "960px";
	o3dDiv.style.height = "510px";
	setTimeout(function(){resizeClient();},50);
	mouseMode = true;
	}
</script>

<style type="text/css">
<!--
#o3d{
	width: 960px;
	height: 510px;
}
#cubeTitle  {
	height:30px;
	}
#cubeTitleName span{
	float:left;
	height:30px;
	font-family: "微软雅黑", Verdana, Tahoma;
	font-size: 20px;
	}
#dataForm {
	position: absolute;
	top:500px;
	left:300px;
}

-->
</style>
</head>
 
<body id="body" onload="startLoad();">
<div id="content" >
    <div id="content_title">
        <a href="http://www.eizia.com/home.html" id="logo-container">
          <h1 id="logo">
             <span>eizia,自由创造与分享！</span>
          </h1>
        </a>
        <div id="content_title_line"></div>
    </div>
        <div id="cubeTitle">
            <div id="cubeTitleName"><span>创建新模型</span>  <a href="http://www.eizia.com/help.html">查看如何操作</a>
</div>
            <div id="cubeTitleButton"  style="float:right">
            <a href="javascript:void(0)" class="button_a_80" onclick="wantSave()"><span>立即保存</span></a>
            </div>
    	</div>
    <div id="o3d"></div>
    <div id="cubeInformation" style="display:none">
        <form id="cubeInformationForm">
        <table>
        <tbody>
        <tr>
        	<td align="right" width="90px">作品名称:</td>
            <td><input type="text" name="modelName" id="modelName" size="20"/></td>
        </tr>
        <tr>
        	<td align="right">作品描述:</td>
            <td><textarea  name="modelDescription"  id="modelDescription" rows="4" cols="81" ></textarea></td>
        </tr>
       	<tr>
            <td><a href="javascript:void(0)" class="button_a_100" 
                    onclick="saveToServer(document.getElementById('cubeInformationForm').cubeData.value,
                    					document.getElementById('cubeInformationForm').modelName.value,
                    					document.getElementById('cubeInformationForm').modelDescription.value)
                                        "><span>确定保存</span></a></td>
            <td><a href="javascript:void(0)" class="button_a_100" onclick="cancelSave()"><span>返回修改</span></a></td>
         </tr>
         <tr>
             <td>
             <textarea name="cubeData" style="display:none" cols="0" rows="0"></textarea>
             </td>
         </tr>
        </tbody>
        </table>
        </form> 
    </div>
  </div>
<div id="userTabs"></div>
<div id="clear"></div>

<script type="text/javascript" src="http://js.tongji.linezing.com/1305450/tongji.js"></script><noscript><a href="http://www.linezing.com"><img src="http://img.tongji.linezing.com/1305450/tongji.gif"/></a></noscript>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-15783668-1");
pageTracker._trackPageview();
} catch(err) {}</script>


</body>
</html>
